[client]
port = 3306
socket = {{ mysql_dir.socketdir }}/mysql.sock

[mysqld]
user = {{ mysql_user }}
port = {{ mysql_port }}
basedir = {{ mysql_dir.basedir }}
datadir = {{ mysql_dir.datadir }}
socket = {{ mysql_dir.socketdir }}/mysql.sock
pid-file = {{ mysql_dir.piddir }}/mysqld.pid

# 设置默认字符编码
character_set_server = utf8
# 插件目录
plugin_dir = {{ mysql_dir.basedir }}/lib/plugin/
# 跳过域名解析
skip_name_resolve = 1
# 不区分表大小写
lower_case_table_names = 1
# 最大连接数
max_connections = 1000
back_log = 600
max_allowed_packet = 64M

# 慢查询设置
slow_query_log = ON
long_query_time = 2
slow_query_log_file = {{ mysql_dir.logdir }}/slow_query.log

# 开启操作日志
general_log = on
general_log_file = {{ mysql_dir.logdir }}/general.log

# 启动日志
log_error={{ mysql_dir.logdir }}/mysqld.log

# 开启binlog
server_id = {{ inventory_hostname.split(".")[3] }}
log_bin = {{ mysql_dir.binlogdir }}/mysql-bin
binlog_format = row
binlog_row_image = minimal
expire_logs_days = 7

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignorea when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

[mysqld_safe]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
